home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 147 / Gekkan Dennou Club - 2000.8 Vol. 147 (Japan).7z / Gekkan Dennou Club - 2000.8 Vol. 147 (Japan) (Track 1).bin / tools / spsx / spsx_s01.lzh / SRC / setmeth.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  4.9 KB  |  238 lines

  1. #include <method\methodSx.h>
  2. #include <sxlib.h>
  3. #include "pcm8pp.h"
  4. #include "spsx.h"
  5.  
  6.  
  7. int MainDraw();
  8.  
  9. proc_list_t                            /* 描画ルーチンリスト */
  10.     mainDraw = {MainDraw, NULL};
  11.  
  12. window_t                            /* ウインドウ定義 */
  13.     mainWin = {&mainDraw, (window *) NULL, (window *) -1, {0, 0, 320, 112},
  14.         "\@Sound Player SX-68K", 0, (49 << 4), 0b0001};
  15.  
  16. /* 操作ボタン用イメージのポインタ */
  17. rectImg **pImgPlayButton;            /* 再生ボタン */
  18. rectImg **pImgStopButton;            /* 停止ボタン */
  19. rectImg **pImgNextButton;            /* 次曲ボタン */
  20. rectImg    **pImgBeforeButton;            /* 前曲ボタン */
  21. rectImg **pImgRandomButton;            /* ランダムボタン */
  22. rectImg **pImgPauseButton;            /* 一時停止ボタン */
  23. rectImg **pImgRestartButton;        /* 再開ボタン */
  24. rectImg **pImgDisRndButton;            /* ランダム取り消しボタン */
  25. rectImg **pImgPushPlayButton;        /* 再生ボタンを押した状態 */
  26. rectImg **pImgPushStopButton;        /* 停止ボタンを押した状態 */
  27. rectImg **pImgPushNextButton;        /* 次曲ボタンを押した状態 */
  28. rectImg **pImgPushBeforeButton;        /* 前曲ボタンを押した状態 */
  29. rectImg **pImgPushRndButton;        /* ランダムボタンを押した状態 */
  30. rectImg **pImgPushPauseButton;        /* 一時停止ボタンを押した状態 */
  31. rectImg **pImgPushRestartButton;    /* 再開ボタンを押した状態 */
  32. rectImg    **pImgPushDisRndButton;        /* ランダム取り消しボタンを押した状態 */
  33.  
  34. rectImg **pImageH[5];        /* イメージボタン配列(通常ボタン)     */
  35. rectImg **pImageL[5];        /*          (押されている時) */
  36.  
  37.  
  38. point_t    astButtonPoint[5] = {            /* ボタンの位置 */
  39.                     Point_t(264,80),    /* 再生 */
  40.                     Point_t(216,80),    /* 停止 */
  41.                     Point_t(136,80),    /* 次曲 */
  42.                     Point_t( 88,80),    /* 前曲 */
  43.                     Point_t(  8,80) };    /* ランダム */
  44.  
  45. m_picbtn_t    stCtrlButton = {
  46.                             pImageH,
  47.                             pImageL,
  48.                             astButtonPoint,
  49.                             5,
  50.                             0x00,
  51.                             Rect(0, 0, 0, 0),
  52.                             NULL,
  53.                             NULL,
  54.                             0 };
  55.  
  56. method_t    mFileDrop = {
  57.                             NULL,
  58.                             m_DRPDWN,
  59.                             NULL,
  60.                             iFileDrop };
  61.  
  62. method_t    mCtrlButton = {
  63.                             &mFileDrop, 
  64.                             m_PICBTN,
  65.                             &stCtrlButton,
  66.                             NULL};
  67.  
  68.  
  69.  
  70. extern int    iPlayTime;
  71.  
  72. extern int    iPlayTrack;
  73.  
  74. extern uchar    *pcPlayTitle;
  75.  
  76. extern    stPlayList_t    stPlayList;
  77.  
  78. extern int    iPlayMode;                /* 再生種別        PLAY_NORMAL                */
  79.                                     /*                 PLAY_RANDOM                */
  80.  
  81. int MainDraw()                        /* 描画関数定義 */
  82. {
  83.     graph *grp = PtrA0(GMExgGraph(&mainWin.wptr->wGraph));
  84.     rect    stRect;
  85.     int     iFontKind;
  86.  
  87.     iFontKind  = GMFontKind(1);            /* 16x16 dot Font */
  88.  
  89.     stRect.top = 8;
  90.     stRect.left = 9;
  91.  
  92.     stRect.right=311;
  93.     stRect.bottom = 71;
  94.  
  95.     ULD3Rect2( &stRect );
  96.  
  97.  
  98.     GMPenMode(0);
  99.     GMShadowStrZ( "Track", Point_t(120, 48) );
  100.     GMShadowStrZ( "Time", Point_t(224, 48) );
  101.  
  102.     GMFontKind(iFontKind);
  103.  
  104.     GMExgGraph(grp);                    /* グラフポートを戻す */
  105.  
  106.     iDrawPlayTime();
  107.     iDrawTrack();
  108.     iDrawTitle();
  109.  
  110.     return 0;
  111. }
  112.  
  113.  
  114. int    iDrawPlayTime()
  115. {
  116.     int        iTenMin;
  117.     int        iMin;
  118.     int        iTenSec;
  119.     int        iSec;
  120.     graph *grp = PtrA0(GMExgGraph(&mainWin.wptr->wGraph));
  121.     int kind = GMFontKind(1);
  122.  
  123.     iTenMin = iPlayTime / 600;
  124.     iMin = (iPlayTime / 60) - (iTenMin * 10);
  125.     iTenSec = (iPlayTime % 60) / 10;
  126.     iSec = iPlayTime % 10;
  127.  
  128.     GMPenMode(0);
  129.     GMFontMode(0);
  130.  
  131.     GMMove(Point_t(264, 48));
  132.     GMDrawChar('0'+iTenMin);
  133.     GMDrawChar('0'+iMin);
  134.     GMDrawChar(':');
  135.     GMDrawChar('0'+iTenSec);
  136.     GMDrawChar('0'+iSec);
  137.  
  138.  
  139.     GMFontKind(kind);
  140.     GMExgGraph(grp);                    /* グラフポートを戻す */
  141.  
  142.     return 0;
  143. }
  144.  
  145. int    iDrawTrack()
  146. {
  147.     int    iTenTrack;
  148.     int    iTrack;
  149.  
  150.     graph *grp = PtrA0(GMExgGraph(&mainWin.wptr->wGraph));
  151.     int kind;
  152.  
  153.     kind  = GMFontKind(0);
  154.  
  155.     iTenTrack = iPlayTrack / 10;
  156.     iTrack = iPlayTrack % 10;
  157.  
  158.     GMPenMode(0);
  159.     GMFontMode(0);
  160.  
  161.     if ( iPlayMode == PLAY_RANDOM ) {
  162.         GMMove(Point_t(40,52));
  163.         GMDrawChar('R');
  164.         GMDrawChar('A');
  165.         GMDrawChar('N');
  166.         GMDrawChar('D');
  167.         GMDrawChar('O');
  168.         GMDrawChar('M');
  169.     }
  170.     else {
  171.         GMMove(Point_t(40,52));
  172.         GMDrawChar(' ');
  173.         GMDrawChar(' ');
  174.         GMDrawChar(' ');
  175.         GMDrawChar(' ');
  176.         GMDrawChar(' ');
  177.         GMDrawChar(' ');
  178.     }
  179.  
  180.     GMFontKind(1);
  181.  
  182.     GMMove(Point_t(168, 48));
  183.     GMDrawChar('0'+iTenTrack);
  184.     GMDrawChar('0'+iTrack);
  185.  
  186.  
  187.     iTenTrack = stPlayList.iMusicCount / 10;
  188.     iTrack = stPlayList.iMusicCount % 10;
  189.     GMDrawChar('/');
  190.     GMDrawChar('0'+iTenTrack);
  191.     GMDrawChar('0'+iTrack);
  192.  
  193.  
  194.     GMFontKind(kind);
  195.     GMExgGraph(grp);                    /* グラフポートを戻す */
  196.  
  197.     return 0;
  198. }
  199.  
  200. iDrawTitle() {
  201.     graph *grp = PtrA0(GMExgGraph(&mainWin.wptr->wGraph));
  202.     int kind;
  203.  
  204.     GMPenMode(0);
  205.     GMFontMode(0);
  206.  
  207.     kind  = GMFontKind(2);
  208.  
  209.     GMMove(Point_t(16,16));
  210.     ULDrawStrCenterL("\@                        \0",24);
  211.  
  212.     if ( pcPlayTitle == NULL ) {    /* タイトル未設定の場合 */
  213.         GMMove(Point_t(16,16));
  214.  
  215.         ULDrawStrCenterL("\@----- NO TITLE -----\0",24);
  216.  
  217.     }
  218.     else {
  219.         if ( strlen(pcPlayTitle) <= 25 ) {
  220.  
  221.             GMMove(Point_t(16,16));
  222.  
  223.             ULDrawStrCenterL(pcPlayTitle,24);
  224.         }
  225.         else {
  226.             GMFontKind(1);
  227.             GMMove(Point_t(16,20));
  228.  
  229.             ULDrawStrCenterL(pcPlayTitle,36);
  230.         }
  231.     }
  232.  
  233.     GMFontKind(kind);
  234.     GMExgGraph(grp);
  235.  
  236.     return 0;
  237. }
  238.